package org.dromara.iot.enums;

import lombok.Getter;

@Getter
public enum BehaviorEnum {
    FALL_DETECTED("FALL_DETECTED", "人员摔倒"),
    JUMP_DETECTED("JUMP_DETECTED", "跳动"),
    IMPROPER_BUTTON_PRESS("IMPROPER_BUTTON_PRESS", "不文明按键"),
    OBSTRUCT_DOOR_CLOSING("OBSTRUCT_DOOR_CLOSING", "妨碍电梯门关闭"),
    CAMERA_OBSTRUCTED("CAMERA_OBSTRUCTED", "遮蔽摄像头");
    private final String code;
    private final String desc;

    BehaviorEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BehaviorEnum getBehaviorEnumByCode(String code) {
        for (BehaviorEnum behaviorEnum : BehaviorEnum.values()) {
            if (behaviorEnum.getCode().equals(code)) {
                return behaviorEnum;
            }
        }
        return null;
    }
}
